home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / DriverGestalt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  22.7 KB  |  544 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        DriverGestalt.h
  3.  
  4.      Contains:    Driver Gestalt interfaces
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __DRIVERGESTALT__
  18. #define __DRIVERGESTALT__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __OSUTILS__
  24. #include <OSUtils.h>
  25. #endif
  26. #ifndef __SCSI__
  27. #include <SCSI.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52. /*__________________________________________________________________________________*/
  53. /* The Driver Gestalt bit in the dCtlFlags */
  54.  
  55. enum {
  56.     kbDriverGestaltEnable        = 2,
  57.     kmDriverGestaltEnableMask    = (1 << kbDriverGestaltEnable)
  58. };
  59.  
  60. /*__________________________________________________________________________________*/
  61. /* Driver Gestalt related csCodes */
  62.  
  63. enum {
  64.     kDriverGestaltCode            = 43,                            /* various uses */
  65.     kDriverConfigureCode        = 43,                            /* various uses */
  66.     kdgLowPowerMode                = 70,                            /* Sets/Returns the current energy consumption level */
  67.     kdgReturnDeviceID            = 120,                            /* returns SCSI DevID in csParam[0] */
  68.     kdgGetCDDeviceInfo            = 121                            /* returns CDDeviceCharacteristics in csParam[0] */
  69. };
  70.  
  71. /*__________________________________________________________________________________*/
  72. /* Driver Gestalt selectors */
  73.  
  74. enum {
  75.     kdgVersion                    = FOUR_CHAR_CODE('vers'),        /* Version number of the driver in standard Apple format */
  76.     kdgDeviceType                = FOUR_CHAR_CODE('devt'),        /* The type of device the driver is driving. */
  77.     kdgInterface                = FOUR_CHAR_CODE('intf'),        /* The underlying interface that the driver is using (if any) */
  78.     kdgSync                        = FOUR_CHAR_CODE('sync'),        /* True if driver only behaves synchronously. */
  79.     kdgBoot                        = FOUR_CHAR_CODE('boot'),        /* value to place in PRAM for this drive (long) */
  80.     kdgWide                        = FOUR_CHAR_CODE('wide'),        /* True if driver supports ioWPosOffset */
  81.     kdgPurge                    = FOUR_CHAR_CODE('purg'),        /* Driver purge permission (True = purge; False = no purge) */
  82.     kdgSupportsSwitching        = FOUR_CHAR_CODE('lpwr'),        /* True if driver supports power switching */
  83.     kdgMin3VPower                = FOUR_CHAR_CODE('pmn3'),        /* Minimum 3.3V power consumption in microWatts */
  84.     kdgMin5VPower                = FOUR_CHAR_CODE('pmn5'),        /* Minimum 5V power consumption in microWatts */
  85.     kdgMax3VPower                = FOUR_CHAR_CODE('pmx3'),        /* Maximum 3.3V power consumption in microWatts */
  86.     kdgMax5VPower                = FOUR_CHAR_CODE('pmx5'),        /* Maximum 5V power consumption in microWatts */
  87.     kdgInHighPower                = FOUR_CHAR_CODE('psta'),        /* True if device is currently in high power mode */
  88.     kdgSupportsPowerCtl            = FOUR_CHAR_CODE('psup'),        /* True if driver supports following five calls */
  89.     kdgAPI                        = FOUR_CHAR_CODE('dAPI'),        /* API support for PC Exchange */
  90.     kdgEject                    = FOUR_CHAR_CODE('ejec'),        /* Eject options for shutdown/restart (Shutdown Mgr) */
  91.     kdgFlush                    = FOUR_CHAR_CODE('flus'),        /* Determine if disk driver supports flush and if it needs a flush */
  92.     kdgVMOptions                = FOUR_CHAR_CODE('vmop'),        /* Disk drive's Virtual Memory options */
  93.     kdgMediaInfo                = FOUR_CHAR_CODE('minf'),        /* return media specific information */
  94.     kdgPhysDriveIconSuite        = FOUR_CHAR_CODE('dics'),        /* Return a pointer to a IconFamily ('icns') data structure for */
  95.                                                                 /* Disk Driver physical drive (formerly in csCode 22) in driverGestaltResponse. */
  96.     kdgMediaIconSuite            = FOUR_CHAR_CODE('mics'),        /* Return a pointer to a IconFamily ('icns') data structure for */
  97.                                                                 /* Disk Driver media (formerly in csCode 21) in driverGestaltResponse. */
  98.                                                                 /* See IconServices.r for information detailing the 'icns' resource data format */
  99.     kdgMediaName                = FOUR_CHAR_CODE('mnam')        /* Return a pointer to a pascal string describing the Disk Driver (formerly in csCode 21) in driverGestaltResponse. */
  100. };
  101.  
  102. /*__________________________________________________________________________________*/
  103. /* Driver Configure selectors */
  104.  
  105. enum {
  106.     kdcFlush                    = FOUR_CHAR_CODE('flus'),        /* Tell a disk driver to flush its cache and any hardware caches */
  107.     kdcVMOptions                = FOUR_CHAR_CODE('vmop')        /* Change the disk driver's Virtual Memory options */
  108. };
  109.  
  110. /*__________________________________________________________________________________*/
  111. /* control parameter block for Driver Configure calls */
  112.  
  113. struct DriverConfigParam {
  114.     QElemPtr                         qLink;
  115.     short                             qType;
  116.     short                             ioTrap;
  117.     Ptr                             ioCmdAddr;
  118.     ProcPtr                         ioCompletion;
  119.     OSErr                             ioResult;
  120.     StringPtr                         ioNamePtr;
  121.     short                             ioVRefNum;
  122.     short                             ioCRefNum;                    /* refNum for I/O operation */
  123.     short                             csCode;                        /* == kDriverConfigureCode */
  124.     OSType                             driverConfigureSelector;
  125.     UInt32                             driverConfigureParameter;
  126. };
  127. typedef struct DriverConfigParam        DriverConfigParam;
  128. /*__________________________________________________________________________________*/
  129. /* status parameter block for Driver Gestalt calls */
  130.  
  131. struct DriverGestaltParam {
  132.     QElemPtr                         qLink;
  133.     short                             qType;
  134.     short                             ioTrap;
  135.     Ptr                             ioCmdAddr;
  136.     ProcPtr                         ioCompletion;
  137.     OSErr                             ioResult;
  138.     StringPtr                         ioNamePtr;
  139.     short                             ioVRefNum;
  140.     short                             ioCRefNum;                    /* refNum for I/O operation */
  141.     short                             csCode;                        /*    == kDriverGestaltCode */
  142.     OSType                             driverGestaltSelector;        /* 'sync', 'vers', etc. */
  143.     UInt32                             driverGestaltResponse;        /* Could be a pointer, bit field or other format */
  144.     UInt32                             driverGestaltResponse1;        /* Could be a pointer, bit field or other format */
  145.     UInt32                             driverGestaltResponse2;        /* Could be a pointer, bit field or other format */
  146.     UInt32                             driverGestaltResponse3;        /* Could be a pointer, bit field or other format */
  147.     UInt16                             driverGestaltfiller;        /* To pad out to the size of a controlPB */
  148. };
  149. typedef struct DriverGestaltParam        DriverGestaltParam;
  150. /* Note that the various response definitions are overlays of the response fields above.
  151.    For instance the deviceType response would be returned in driverGestaltResponse.
  152.    The DriverGestaltPurgeResponse would be in driverGestaltResponse and driverGestaltResponse1
  153. */
  154. /* GetDriverGestaltDevTResponse(gestaltPtr)->deviceType */
  155. #define GetDriverGestaltDevTResponse(p) ((DriverGestaltDevTResponse *)(&((p)->driverGestaltResponse)))
  156. #define GetDriverGestaltIntfResponse(p) ((DriverGestaltIntfResponse *)(&((p)->driverGestaltResponse)))
  157. #define GetDriverGestaltPowerResponse(p) ((DriverGestaltPowerResponse *)(&((p)->driverGestaltResponse)))
  158. #define GetDriverGestaltSyncResponse(p) ((DriverGestaltSyncResponse *)(&((p)->driverGestaltResponse)))
  159. #define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
  160. #define GetDriverGestaltBootResponse(p) ((DriverGestaltBootResponse *)(&((p)->driverGestaltResponse)))
  161. #define GetDriverGestaltPurgeResponse(p) ((DriverGestaltPurgeResponse *)(&((p)->driverGestaltResponse)))
  162. #define GetDriverGestaltEjectResponse(p) ((DriverGestaltEjectResponse *)(&((p)->driverGestaltResponse)))
  163. #define GetDriverGestaltVersionResponse(p) (((NumVersion*)(&((p)->driverGestaltResponse))))
  164. #define GetDriverGestaltAPIResponse(p) ((DriverGestaltAPIResponse *)(&((p)->driverGestaltResponse)))
  165. #define GetDriverGestaltBooleanResponse(p) ((Boolean *)(&((p)->driverGestaltResponse)))
  166. #define GetDriverGestaltFlushResponse(p) ((DriverGestaltFlushResponse *)(&((p)->driverGestaltResponse)))
  167. #define GetDriverGestaltVMOptionsResponse(p) ((DriverGestaltVMOptionsResponse *)(&((p)->driverGestaltResponse)))
  168. #define GetDriverGestaltMediaInfoResponse(p) ((DriverGestaltMediaInfoResponse *)(&((p)->driverGestaltResponse)))
  169. /*__________________________________________________________________________________*/
  170. /* Device Types response */
  171.  
  172. struct DriverGestaltDevTResponse {
  173.     OSType                             deviceType;
  174. };
  175. typedef struct DriverGestaltDevTResponse DriverGestaltDevTResponse;
  176.  
  177. enum {
  178.     kdgDiskType                    = FOUR_CHAR_CODE('disk'),        /* standard r/w disk drive */
  179.     kdgTapeType                    = FOUR_CHAR_CODE('tape'),        /* tape drive */
  180.     kdgPrinterType                = FOUR_CHAR_CODE('prnt'),        /* printer */
  181.     kdgProcessorType            = FOUR_CHAR_CODE('proc'),        /* processor */
  182.     kdgWormType                    = FOUR_CHAR_CODE('worm'),        /* write-once */
  183.     kdgCDType                    = FOUR_CHAR_CODE('cdrm'),        /* cd-rom drive */
  184.     kdgFloppyType                = FOUR_CHAR_CODE('flop'),        /* floppy disk drive */
  185.     kdgScannerType                = FOUR_CHAR_CODE('scan'),        /* scanner */
  186.     kdgFileType                    = FOUR_CHAR_CODE('file'),        /* Logical Partition type based on a file (Drive Container) */
  187.     kdgRemovableType            = FOUR_CHAR_CODE('rdsk')        /* A removable media hard disk drive ie. Syquest, Bernioulli */
  188. };
  189.  
  190. /*__________________________________________________________________________________*/
  191. /* Device Interfaces response */
  192.  
  193. struct DriverGestaltIntfResponse {
  194.     OSType                             interfaceType;
  195. };
  196. typedef struct DriverGestaltIntfResponse DriverGestaltIntfResponse;
  197.  
  198. enum {
  199.     kdgScsiIntf                    = FOUR_CHAR_CODE('scsi'),
  200.     kdgPcmciaIntf                = FOUR_CHAR_CODE('pcmc'),
  201.     kdgATAIntf                    = FOUR_CHAR_CODE('ata '),
  202.     kdgFireWireIntf                = FOUR_CHAR_CODE('fire'),
  203.     kdgExtBus                    = FOUR_CHAR_CODE('card')
  204. };
  205.  
  206. /*__________________________________________________________________________________*/
  207. /* Power Saving */
  208.  
  209. struct DriverGestaltPowerResponse {
  210.     unsigned long                     powerValue;                    /* Power consumed in µWatts */
  211. };
  212. typedef struct DriverGestaltPowerResponse DriverGestaltPowerResponse;
  213. /*__________________________________________________________________________________*/
  214. /* Disk Specific */
  215.  
  216. struct DriverGestaltSyncResponse {
  217.     Boolean                         behavesSynchronously;
  218.     UInt8                             pad[3];
  219. };
  220. typedef struct DriverGestaltSyncResponse DriverGestaltSyncResponse;
  221.  
  222. struct DriverGestaltBootResponse {
  223.     UInt8                             extDev;                        /*  Packed target (upper 5 bits) LUN (lower 3 bits) */
  224.     UInt8                             partition;                    /*  Unused */
  225.     UInt8                             SIMSlot;                    /*  Slot */
  226.     UInt8                             SIMsRSRC;                    /*  sRsrcID */
  227. };
  228. typedef struct DriverGestaltBootResponse DriverGestaltBootResponse;
  229.  
  230. struct DriverGestaltAPIResponse {
  231.     short                             partitionCmds;                /* if bit 0 is nonzero, supports partition control and status calls */
  232.                                                                 /*         prohibitMounting (control, kProhibitMounting) */
  233.                                                                 /*         partitionToVRef (status, kGetPartitionStatus) */
  234.                                                                 /*         getPartitionInfo (status, kGetPartInfo) */
  235.     short                             unused1;                    /* all the unused fields should be zero */
  236.     short                             unused2;
  237.     short                             unused3;
  238.     short                             unused4;
  239.     short                             unused5;
  240.     short                             unused6;
  241.     short                             unused7;
  242.     short                             unused8;
  243.     short                             unused9;
  244.     short                             unused10;
  245. };
  246. typedef struct DriverGestaltAPIResponse    DriverGestaltAPIResponse;
  247.  
  248. struct DriverGestaltFlushResponse {
  249.     Boolean                         canFlush;                    /* Return true if driver supports the */
  250.                                                                 /* kdcFlush Driver Configure _Control call */
  251.     Boolean                         needsFlush;                    /* Return true if driver/device has data cached */
  252.                                                                 /* and needs to be flushed when the disk volume */
  253.                                                                 /* is flushed by the File Manager */
  254.     UInt8                             pad[2];
  255. };
  256. typedef struct DriverGestaltFlushResponse DriverGestaltFlushResponse;
  257. /* Flags for purge permissions */
  258.  
  259. enum {
  260.     kbCloseOk                    = 0,                            /* Ok to call Close */
  261.     kbRemoveOk                    = 1,                            /* Ok to call RemoveDrvr */
  262.     kbPurgeOk                    = 2,                            /* Ok to call DisposePtr */
  263.     kmNoCloseNoPurge            = 0,
  264.     kmOkCloseNoPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk),
  265.     kmOkCloseOkPurge            = (1 << kbCloseOk) + (1 << kbRemoveOk) + (1 << kbPurgeOk)
  266. };
  267.  
  268. /* Driver purge permission structure */
  269.  
  270. struct DriverGestaltPurgeResponse {
  271.     UInt16                             purgePermission;            /* 0 = Do not change the state of the driver */
  272.                                                                 /* 3 = Do Close() and DrvrRemove() this driver */
  273.                                                                 /* but don't deallocate driver code */
  274.                                                                 /* 7 = Do Close(), DrvrRemove(), and DisposePtr() */
  275.     UInt16                             purgeReserved;
  276.     Ptr                             purgeDriverPointer;            /* pointer to the start of the driver block (valid */
  277.                                                                 /* only of DisposePtr permission is given */
  278. };
  279. typedef struct DriverGestaltPurgeResponse DriverGestaltPurgeResponse;
  280.  
  281. struct DriverGestaltEjectResponse {
  282.     UInt32                             ejectFeatures;                /*  */
  283. };
  284. typedef struct DriverGestaltEjectResponse DriverGestaltEjectResponse;
  285. /* Flags for Ejection Features field */
  286.  
  287. enum {
  288.     kRestartDontEject            = 0,                            /* Dont Want eject during Restart */
  289.     kShutDownDontEject            = 1,                            /* Dont Want eject during Shutdown */
  290.     kRestartDontEject_Mask        = 1 << kRestartDontEject,
  291.     kShutDownDontEject_Mask        = 1 << kShutDownDontEject
  292. };
  293.  
  294. /*
  295.     The DriverGestaltVMOptionsResponse is returned by a disk driver in response to a
  296.     kdgVMOptions Driver Gestalt request. This allows a disk driver to tell VM a few
  297.     things about a disk drive. For example:
  298.     
  299.     • A drive that should never be in the page fault path should return kAllowVMNoneMask.
  300.       Examples of this are drives that have manual eject buttons that are not disabled by
  301.       software, drives with very slow throughput, or drives that depend on
  302.       a network connection.
  303.     • A drive that should never be written to but is safe for read-only file mapping
  304.       should return kAllowVMReadOnlyMask. Examples of this are WORM drives where each write
  305.       eats write-once space on the disk and CD-ROM drives which are read-only media.
  306.     • A drive that should allow VM to create its main backing store file should return
  307.       kAllowVMReadWriteMask. Examples of this are fast read/write drives that don't allow
  308.       manual eject and don't use a network connection.
  309.     
  310.     A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
  311.     what disk drive this call is for. This is a per-drive call, not a per-driver call.
  312.     
  313.     The only three valid responses to kdgVMOptions at this time are kAllowVMNoneMask,
  314.     kAllowVMReadOnlyMask, and kAllowVMReadWriteMask (i.e., setting only kAllowVMWriteBit
  315.     is not valid).
  316.     
  317.     Important: All bits not defined here are reserved and should be set to zero until
  318.     they are defined for a specific purpose.
  319.     
  320.     The kdcVMOptions Driver Configure _Control call provides the ability to change a driver's
  321.     response to kdgVMOptions Driver Gestalt requests. A driver should return controlErr if
  322.     it doesn't want to provide the ability to change the kdgVMOptions response. If a driver
  323.     supports the kdcVMOptions Driver Configure _Control call, but is asked to set an option bit
  324.     that it doesn't support (for example, if a read-only device is asked to set the kAllowVMWriteBit),
  325.     it should return paramErr.
  326. */
  327.  
  328. struct DriverGestaltVMOptionsResponse {
  329.     UInt32                             vmOptions;
  330. };
  331. typedef struct DriverGestaltVMOptionsResponse DriverGestaltVMOptionsResponse;
  332. /* Bits and masks for DriverGestaltVMOptionsResponse.vmOptions field */
  333.  
  334. enum {
  335.     kAllowVMReadBit                = 0,                            /* Allow VM to use this drive for read access */
  336.     kAllowVMWriteBit            = 1,                            /* Allow VM to use this drive for write access */
  337.     kAllowVMNoneMask            = 0,
  338.     kAllowVMReadOnlyMask        = 1 << kAllowVMReadBit,
  339.     kAllowVMReadWriteMask        = (1 << kAllowVMReadBit) + (1 << kAllowVMWriteBit)
  340. };
  341.  
  342. /*
  343.     The DriverGestaltMediaInfoResponse is returned by a disk driver in response to a
  344.     kdgMediaInfo DriverGestalt request. This allows a disk driver to tell callers the
  345.     physical block size, the number of blocks that are of that size, and the media type
  346.     for a given device.
  347.     
  348.     A disk driver must look at the ioVRefNum field of the DriverGestaltParam to determine
  349.     what disk drive this call is for. This is a per-drive call, not a per-driver call.
  350.     
  351.     On drives that support ejectable media, the response can change depending on what
  352.     media is currently in the drive.
  353. */
  354.  
  355. struct DriverGestaltMediaInfoResponse {
  356.     UInt32                             numberBlocks;                /* number of blocks */
  357.     UInt32                             blockSize;                    /* physical size of blocks */
  358.     SInt16                             mediaType;                    /* media type identifier */
  359. };
  360. typedef struct DriverGestaltMediaInfoResponse DriverGestaltMediaInfoResponse;
  361. /* DriverGestaltMediaInfoResponse.mediaType constants */
  362.  
  363. enum {
  364.     kMediaTypeUnknown            = 128,                            /* media type is unknown */
  365.     kMediaTypeCDROM                = 129,                            /* media type is a CD-ROM */
  366.     kMediaTypeDVDROM            = 130,                            /* media type is a DVD-ROM */
  367.     kMediaTypeNoMedia            = -1                            /* no media is present */
  368. };
  369.  
  370. /*__________________________________________________________________________________*/
  371. /* CD-ROM Specific */
  372. /* The CDDeviceCharacteristics result is returned in csParam[0] and csParam[1] of a 
  373.    standard CntrlParam parameter block called with csCode kdgGetCDDeviceInfo.
  374. */
  375.  
  376. struct CDDeviceCharacteristics {
  377.     UInt8                             speedMajor;                    /* High byte of fixed point number containing drive speed */
  378.     UInt8                             speedMinor;                    /* Low byte of "" CD 300 == 2.2, CD_SC == 1.0 etc. */
  379.     UInt16                             cdFeatures;                    /* Flags field for features and transport type of this CD-ROM */
  380. };
  381. typedef struct CDDeviceCharacteristics    CDDeviceCharacteristics;
  382.  
  383. enum {
  384.     cdFeatureFlagsMask            = 0xFFFC,                        /* The Flags are in the first 14 bits of the cdFeatures field */
  385.     cdTransportMask                = 0x0003                        /* The transport type is in the last 2 bits of the cdFeatures field */
  386. };
  387.  
  388.  
  389. /* Flags for CD Features field */
  390.  
  391. enum {
  392.     cdMute                        = 0,                            /* The following flags have the same bit number */
  393.     cdLeftToChannel                = 1,                            /* as the Audio Mode they represent.  Don't change */
  394.     cdRightToChannel            = 2,                            /* them without changing dControl.c */
  395.     cdLeftPlusRight                = 3,                            /* Reserve some space for new audio mixing features (4-7) */
  396.     cdSCSI_2                    = 8,                            /* Supports SCSI2 CD Command Set */
  397.     cdStereoVolume                = 9,                            /* Can support two different volumes (1 on each channel) */
  398.     cdDisconnect                = 10,                            /* Drive supports disconnect/reconnect */
  399.     cdWriteOnce                    = 11,                            /* Drive is a write/once (CD-R?) type drive */
  400.     cdMute_Mask                    = 1 << cdMute,
  401.     cdLeftToChannel_Mask        = 1 << cdLeftToChannel,
  402.     cdRightToChannel_Mask        = 1 << cdRightToChannel,
  403.     cdLeftPlusRight_Mask        = 1 << cdLeftPlusRight,
  404.     cdSCSI_2_Mask                = 1 << cdSCSI_2,
  405.     cdStereoVolume_Mask            = 1 << cdStereoVolume,
  406.     cdDisconnect_Mask            = 1 << cdDisconnect,
  407.     cdWriteOnce_Mask            = 1 << cdWriteOnce
  408. };
  409.  
  410. /* Transport types */
  411.  
  412. enum {
  413.     cdCaddy                        = 0,                            /* CD_SC,CD_SC_PLUS,CD-300 etc. */
  414.     cdTray                        = 1,                            /* CD_300_PLUS etc. */
  415.     cdLid                        = 2                                /* Power CD - eg no eject mechanism */
  416. };
  417.  
  418. /* the following are used by PC Exchange (and Apple DOS/PC Compatibility Card)*/
  419.  
  420. /* Control Codes*/
  421.  
  422. enum {
  423.     kRegisterPartition            = 50,                            /* PCX needs a new Drive (for a non-macintosh partition found on the disk)*/
  424.     OLD_REGISTER_PARTITION        = 301,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  425.     THE_DRIVE                    = 0,                            /* DrvQElPtr for the partition to register*/
  426.     THE_PHYS_START                = 1,                            /* The start of the partition in logical blocks*/
  427.     THE_PHYS_SIZE                = 2,                            /* The size of the partition in logical blocks*/
  428.     kGetADrive                    = 51,                            /* control call to ask the driver to create a drive*/
  429.     OLD_GET_A_DRIVE                = 302,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  430.     THE_VAR_QUEL                = 0,                            /* a VAR parameter for the returned DrvQElPtr*/
  431.     kProhibitMounting            = 52,                            /* Dont allow mounting of the following drives*/
  432.     kOldProhibitMounting        = 2100,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  433.     kProhibitDevice                = 0,                            /* CS Param 0 and 1 (partInfoRecPtr)*/
  434.     kIsContainerMounted            = 53,
  435.     kOldIsContainerMounted        = 2201,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card            */
  436.     kContainerVRef                = 0,                            /* CS Param 0 and 1 (VRefNum)*/
  437.     kContainerParID                = 1,                            /* CS Param 2 and 3 (Parent ID)*/
  438.     kContainerName                = 2,                            /* CS Param 4 and 5 (File Name)*/
  439.     kContainerResponse            = 3,                            /* CS Param 6 and 7 (VAR pointer to short result)*/
  440.     kMountVolumeImg                = 54,
  441.     OLD_MOUNT_VOLUME_IMG        = 2000,
  442.     MV_HOST_VREFNUM                = 0,
  443.     MV_HOST_PAR_ID                = 1,
  444.     MV_HOST_NAME                = 2,
  445.     MV_REQ_PERM                    = 3
  446. };
  447.  
  448. /* Status Codes*/
  449.  
  450.  
  451. enum {
  452.     kGetPartitionStatus            = 50,                            /* what is the status of this partition?*/
  453.     kOldGetPartitionStatus        = 2200,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  454.     kDeviceToQuery                = 0,                            /* CS Param 0 and 1 (partInfoRecPtr)*/
  455.     kDeviceResponse                = 1,                            /* CS Param 2 and 3 (VAR pointer to short result)*/
  456.     kGetPartInfo                = 51,                            /* Get a partition info record based on the provided vrefnum*/
  457.     kOldGetPartInfo                = 2300,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  458.     kPartInfoResponse            = 0,                            /* var parameter (pointer to partInfoRec) CSParam [0-1]*/
  459.     kGetContainerAlias            = 52,                            /* Get the alias that describes the file this drive was mounted from.*/
  460.     kOldGetContainerAlias        = 2400,                            /* left in for compatibility with shipping Apple DOS/PC Compatibility Card*/
  461.     kGetAliasResponse            = 0                                /*    var parameter (pointer to a Handle) CSParam [0-1]*/
  462. };
  463.  
  464. /* the result codes to come from the driver interface */
  465.  
  466.  
  467. enum {
  468.     DRIVER_NOT_INSTALLED        = -1,
  469.     DRIVER_BUSY                    = -2,
  470.     CANT_MOUNT_WITHIN_THIS_FS    = -3,                            /* can only mount container within residing on HFS volume*/
  471.     VOLUME_ALREADY_MOUNTED        = -4                            /* Already Mounted*/
  472. };
  473.  
  474. /* requisite structures for PCX control and status calls*/
  475.  
  476.  
  477. enum {
  478.     kMaxProhibted                = 2                                /* the max number of volumes the PC can possibly have mounted*/
  479. };
  480.  
  481. /* GestaltSelector for Finding Driver information*/
  482.  
  483.  
  484. enum {
  485.     kGetDriverInfo                = FOUR_CHAR_CODE('vdrc')
  486. };
  487.  
  488.  
  489. enum {
  490.     VerifyCmd                    = 5,
  491.     FormatCmd                    = 6,
  492.     EjectCmd                    = 7
  493. };
  494.  
  495. /* Partition information passed back and forth between PCX and the driver*/
  496.  
  497. struct partInfoRec {
  498.     DeviceIdent                     SCSIID;                        /* DeviceIdent for the device*/
  499.     UInt32                             physPartitionLoc;            /* physical block number of beginning of partition*/
  500.     UInt32                             partitionNumber;            /* the partition number of this partition*/
  501. };
  502. typedef struct partInfoRec                partInfoRec;
  503. typedef partInfoRec *                    partInfoRecPtr;
  504.  
  505. struct vPartInfoRec {
  506.     UInt8                             VPRTVers;                    /* Virtual partition version number*/
  507.     UInt8                             VPRTType;                    /* virtual partition type (DOS, HFS, etc)*/
  508.     SInt16                             drvrRefNum;                    /* Driver Reference number of partition driver*/
  509. };
  510. typedef struct vPartInfoRec                vPartInfoRec;
  511. typedef vPartInfoRec *                    vPartInfoRecPtr;
  512. /* Information related to DOS partitions*/
  513.  
  514. enum {
  515.     kDOSSigLow                    = 0x01FE,                        /* offset into boot block for DOS signature*/
  516.     kDOSSigHi                    = 0x01FF,                        /* offset into boot block for DOS signature*/
  517.     kDOSSigValLo                = 0x55,                            /* DOS signature value in low byte*/
  518.     kDOSSigValHi                = 0xAA                            /* DOS signature value in high byte*/
  519. };
  520.  
  521.  
  522.  
  523.  
  524. #if PRAGMA_STRUCT_ALIGN
  525.     #pragma options align=reset
  526. #elif PRAGMA_STRUCT_PACKPUSH
  527.     #pragma pack(pop)
  528. #elif PRAGMA_STRUCT_PACK
  529.     #pragma pack()
  530. #endif
  531.  
  532. #ifdef PRAGMA_IMPORT_OFF
  533. #pragma import off
  534. #elif PRAGMA_IMPORT
  535. #pragma import reset
  536. #endif
  537.  
  538. #ifdef __cplusplus
  539. }
  540. #endif
  541.  
  542. #endif /* __DRIVERGESTALT__ */
  543.  
  544.